<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Toast Notification Sample</title>
        <link href="description/Galleries.css" type="text/css" rel="Stylesheet" /><link href="description/Layout.css" type="text/css" rel="Stylesheet" /><link href="description/Brand.css" type="text/css" rel="Stylesheet" />
        <link href="description/iframedescription.css" rel="Stylesheet" type="text/css" />
        <script src="description/offline.js" type="text/javascript"></script>
        <style type="text/css">
            #projectInfo {
                overflow: auto;
            }
            #longDesc {
                clear:both;
                margin: 25px 0 10px 0;
            }

            #SampleIndexList{
                margin-left: 15px;
            }
        </style>
    </head>
<body>
    <div id="offlineDescription">
        <div id="projectInfo">
            <div class="section">
                    <div class="itemBarLong tagsContainer">
                        <label for="Technologies">Technologies</label>
                        <div id="Technologies">
                            windows phone 7.5
                        </div>
                    </div>
                    <div class="itemBarLong tagsContainer">
                        <label for="Topics">Topics</label>
                        <div id="Topics">
                            User Interface, Notifications, Networking
                        </div>
                    </div>
                <div class="itemBar">
                    <label for="LastUpdated">Last Updated</label>
                    <div id="LastUpdated">7/31/2012</div>
                </div>
                <div class="itemBarLong">
                    <label for="License">License</label>
                    <div id="License">
                        <a href="license.rtf">MS-LPL</a></div>
                </div>
                <div class="itemBar">
                    <div class="viewonlinecont">
                        <a data-link="online" href="http://code.msdn.microsoft.com/Toast-Notification-Sample-fb20ae13">View this sample online</a>
                    </div>
                </div>
            </div>
        </div>
        
                   
<script type="text/javascript">
    function initializePage() {
        var otherTabClass = 'otherTab';
        var hiddenPreClass = 'hidden';

        var htmlDecode = function(encodedData) {
            var decodedData = "";
            if (encodedData) {
                var div = document.createElement('div');
                div.innerHTML = encodedData;
                decodedData = div.firstChild.nodeValue.replace( /\\r\\n/ig , '\r\n');
            }
            return decodedData;
        };
                
        Galleries.iterateElem(Galleries.findElem(null, 'div', 'scriptcode'), function (index, scriptBlock) {
            var titleElem = Galleries.findElem(scriptBlock, 'div', 'title')[0];
            var labelElems = Galleries.findElem(titleElem, 'span');
            if (labelElems.length == 0) {
                labelElems = titleElem;
            }
            var languageSpans = Galleries.findElem(scriptBlock, 'span', 'hidden');
            var pres = Galleries.findElem(scriptBlock, 'pre');
            if (languageSpans.length > 0 && pres.length > 1) {
                Galleries.iterateElem(labelElems, function(index, elem) {
                    var codePre = pres[index];
                    var labelSpan = elem;
                    var languageSpan = languageSpans[index];
                            
                    elem.code = codePre.innerHTML.replace( /(\r(\n)?)|((\r)?\n)/ig , '\\r\\n');
                            
                    codePre.className = codePre.className.replace(hiddenPreClass, '');
                            
                    languageSpan.parentNode.removeChild(languageSpan);
                });

                pres = Galleries.findElem(scriptBlock, 'pre');
                Galleries.iterateElem(labelElems, function(index, elem) {
                    var codePre = pres[index];
                    var labelSpan = elem;
                    if (index == 0) {
                        scriptBlock.activeTab = 0;
                    }
                    else {
                        labelSpan.className += otherTabClass;
                        codePre.className += hiddenPreClass;
                    }
                    Galleries.attachEventHandler(labelSpan, 'click', function(e) {
                        var activeTab = scriptBlock.activeTab;
                        labelElems[activeTab].className += otherTabClass;
                        pres[activeTab].className += hiddenPreClass;

                        codePre.className = codePre.className.replace(hiddenPreClass, '');
                        labelSpan.className = labelSpan.className.replace(otherTabClass, '');
                        scriptBlock.activeTab = index;
                    });
                });

                var preview = Galleries.findElem(scriptBlock, 'div', 'preview');
                if (preview.length == 0) {
                    preview.push(pres[pres.length - 1]);
                }
                Galleries.iterateElem(preview, function(index, elem) {
                    elem.parentNode.removeChild(elem);
                });

                if (window.clipboardData && clipboardData.setData) {
                    var copyLink = document.createElement('a');
                    copyLink.href = 'javascript:void(0);';
                    copyLink.className = 'copyCode';
                    copyLink.innerHTML = 'Copy Code';
                    Galleries.attachEventHandler(copyLink, 'click', function (e) {
                        clipboardData.setData("Text", htmlDecode(labelElems[scriptBlock.activeTab].code));
                        return false;
                    });
                    scriptBlock.insertBefore(copyLink, scriptBlock.childNodes[0]);
                }
            }
        });
    }

    Galleries.onWindowLoad(function(){
        initializePage();
    });

</script>
<div id="longDesc">
    
<div id="mainBody">
<div class="summary">
<p>This sample demonstrates how to send a toast notification to a Windows&nbsp;Phone using the Microsoft Push Notification Service. It uses two projects, one for the client code that sets up the Windows&nbsp;Phone to receive a notification, and one that sends the notification.</p>
</div>
<div class="introduction">
<p>This sample demonstrates how to send a toast notification to a Windows&nbsp;Phone using the Microsoft Push Notification Service. This sample contains two projects – one project for the client code that sets up the Windows&nbsp;Phone device to receive a notification,
 and another project that sends the notification to the Microsoft Push Notification Service.</p>
<p>For more information about Push Notifications, see <a href="http://go.microsoft.com/fwlink/?LinkID=219458">
Push Notifications Overview for Windows Phone</a>. For a walkthrough of creating this sample application, see
<a href="http://go.microsoft.com/fwlink/?LinkID=219460">How to: Send and Receive Toast Notifications for Windows Phone</a>.</p>
<p>You need to install Windows&nbsp;Phone&nbsp;SDK&nbsp;7.1 to run this sample. To get started, go to
<a href="http://go.microsoft.com/fwlink/?LinkID=259204">App Hub</a>.</p>
<p>The project that sends a toast notification from an ASP.NET webpage running on a web server requires either the full version of Visual Studio or the free
<a href="http://go.microsoft.com/fwlink/?LinkID=216094">Microsoft Visual Web Developer&nbsp;2010 Express</a>.</p>
<h3 class="procedureSubHeading">To run the sample</h3>
<div class="subSection">
<ol>
<li>
<p>After unzipping the sample, note that there are two projects. </p>
</li><li>
<p>Double-click <span class="ui">sdkToastNotificationCS.sln</span> or <span class="ui">
sdkToastNotificationVB.sln</span> to open the solution.</p>
</li><li>
<p>Press F5 to start debugging the application.</p>
</li><li>
<p>When the application launches in Windows&nbsp;Phone Emulator, there will be a brief pause and then a message box containing the notification channel URI will appear. Close the message box. The URI also will be displayed in the Visual Studio debugger Output window.</p>
</li><li>
<p>Copy this URI from the Visual Studio debugger Output window to the clipboard.</p>
</li><li>
<p>Now find SendToast.sln and open it with a full version of Visual Studio or the free
<a href="http://go.microsoft.com/fwlink/?LinkID=216094">Microsoft Visual Web Developer&nbsp;2010 Express</a>.</p>
</li><li>
<p>Press F5 to start debugging the application.</p>
</li><li>
<p>A webpage will open. Paste the notification channel URI into the URI text box on the webpage.</p>
</li><li>
<p>Enter a couple of values for the toast and press the <span class="ui">Send Toast</span> button.</p>
</li><li>
<p>If your client application is running, a message box will appear with the toast values. If your application is not running, a toast will appear at the top of the screen with the toast message.</p>
</li></ol>
</div>
</div>
</div>

</div>


    </div>
</body>
</html>
